package com.yanqu.road.server.cmd.cross.tradewar;

import com.yanqu.road.pb.cross.tradewar.CrossTradeWarProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.TradeWarActivityMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CROSS_TRADE_WAR_NOTIFY_ENEMY_ADD_RECORD, desc = "跨服商战到对手区服战斗")
public class CrossTradeWarNotifyEnemyAddRecordCmd extends AbstractCommand {
	private long enemyUserId;
	private int battleType;
	private String recordUid;
	private int killPatronsCount;
	private int enemyLoseScore;
	private boolean isCancel;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		CrossTradeWarProto.CrossTradeWarNotifyEnemyAddRecordMsg reqMsg = CrossTradeWarProto.CrossTradeWarNotifyEnemyAddRecordMsg.parseFrom(packet.getBytes());
		enemyUserId = reqMsg.getEnemyUserId();
		battleType = reqMsg.getBattleType();
		recordUid = reqMsg.getRecordUid();
		killPatronsCount = reqMsg.getKillPatronsCount();
		enemyLoseScore = reqMsg.getEnemyLoseScore();
		isCancel = reqMsg.getIsCancel();
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		TradeWarActivityMgr.notifyEnemyAddRecord(enemyUserId, battleType, recordUid, killPatronsCount, enemyLoseScore, isCancel);
	}

	@Override
	public void sendData(GamePlayer player) {

	}

}
